package com.chuyu.jzwboa.activity.mailist;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;

import com.chuyu.jzwboa.R;
import com.chuyu.jzwboa.adapter.maillist.MailListAdapter;
import com.chuyu.jzwboa.base.MVPBaseActivity;
import com.chuyu.jzwboa.presenter.maillist.MailListPresenter;
import com.chuyu.jzwboa.utils.sys.StatusBarUtils;
import com.chuyu.jzwboa.view.iview.maillist.IMailListView;
import com.chuyu.jzwboa.widget.MikyouLetterListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 通讯录
 */
public class MailListActivity extends MVPBaseActivity<IMailListView, MailListPresenter> implements IMailListView, View.OnClickListener {


	@BindView(R.id.iv_cancel_maillist)
	ImageView ivCancelMaillist;
	@BindView(R.id.rl_maillist)
	RelativeLayout rlMaillist;
	@BindView(R.id.id_listview)
	ListView idListview;
	@BindView(R.id.id_letterview)
	MikyouLetterListView idLetterview;
	private MailListPresenter mailListPresenter;
	private MailListAdapter mailListAdapter;

	@NonNull
	@Override
	public MailListPresenter createPresenter() {
		mailListPresenter = new MailListPresenter();
		return mailListPresenter;
	}

	@Override
	protected int initContent() {
		return R.layout.activity_mail_list;
	}

	@Override
	protected void initView() {
		ivCancelMaillist.setOnClickListener(this);
		idListview.setDividerHeight(0);
	}

	@Override
	protected void initData() {
		/**
		 * 动态设置状态栏高度
		 */
		int statusHeight = StatusBarUtils.getStatusHeight(this);
		rlMaillist.setPadding(0, statusHeight, 0, 0);
		List<Integer> list = new ArrayList<>();
		list.add(1);
		list.add(1);
		list.add(1);
		list.add(1);
		list.add(1);
		mailListAdapter = new MailListAdapter(getApplicationContext(), list);
		idListview.setAdapter(mailListAdapter);
		idListview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
					//跳转个人信息
					startActivity(new Intent(getApplicationContext(),PersonalMsgActivity.class));
			}
		});
	}

	@Override
	public void showPorgressBar() {

	}

	@Override
	public void closePorfressBar() {

	}

	@Override
	public void LoginSuccess() {

	}

	@Override
	public void LoginFailed() {

	}

	@Override
	public void LoadExpetion() {

	}

	@Override
	public void onClick(View view) {
		switch (view.getId()) {
			case R.id.iv_cancel_maillist:
				finish();
				break;
		}
	}
}
